/*
 * DOpenGLPoseViewer.h
 *
 *  Created on: May 9, 2016
 *      Author: throne
 */

#ifndef KINFU_SLAM_SRC_VIEWER_DOPENGLPOSEVIEWER_H_
#define KINFU_SLAM_SRC_VIEWER_DOPENGLPOSEVIEWER_H_

#include "GL/glew.h"
#include "GL/freeglut.h"
#include "glm/mat4x4.hpp"
#include "glm/gtc/matrix_transform.hpp"
#include "glm/gtc/type_ptr.hpp"
class DOpenGLPoseViewer {

private:
	bool isInited;
	GLuint vao;
	GLuint vbo_vertex;
	GLuint vbo_norm;
	GLuint vbo_color;
	int pointNum;
	glm::mat4 modelMatrix;
public:
	bool Init();
	bool IsInited() const;
	void CleanUp();
	bool InitCamModel(float cam_xs = 0.2, float cam_ys = 0.1, float cam_zs = 0.3);
	bool InitQuadcopterModel(float length = 0.6, float circle_radius = 0.1, float color_r = 1.0, float color_g = 0.1, float color_b = 0.1);


	bool LoadLines(const GLfloat* data, int float_per_point, int pointNum, GLenum usage);
	bool LoadNorm(const GLfloat* data, int float_per_point, int pointNum_, GLenum usage);
	bool LoadColor(const GLfloat* data, int float_per_point, int pointNum_, GLenum usage);
	void ResetModelMatrix();
	void SetModelMatrix(const float pose_R[9], const float pose_T[3]);
	const float*  GetModelMatrixPtr() const;
	bool DrawPoseAsCam(int render_modelMatrix_position) const;
	GLuint GetVAOHandle() const;
	GLuint GetVBOHandle() const;
public:
	DOpenGLPoseViewer();
	virtual ~DOpenGLPoseViewer();
};

#endif /* KINFU_SLAM_SRC_VIEWER_DOPENGLPOSEVIEWER_H_ */
